import request from '@/utils/request'


export interface categoryView {
    category1Id: number,
    category1Name: string,
    category2Id: number,
    category2Name: string,
    category3Id: number,
    category3Name: string,
    id: number,
}
export interface spuSaleAttrValueList {
    baseSaleAttrId: number,
    id: number,
    isChecked: string,
    saleAttrName: string,
    saleAttrValueName: string,
    spuId: number
}
export interface spuSaleAttrList {
    baseSaleAttrId: number,
    id: number,
    saleAttrName: string
    spuId: number,
    spuSaleAttrValueList: spuSaleAttrValueList[]
}

export interface skuAttrValueList {
    attrId: number,
    attrName: string,
    id: number,
    skuId: number,
    valueId: number,
    valueName: string
}

export interface skuImageList {
    id: number,
    imgName: string,
    imgUrl: string,
    isDefault: string,
    skuId: number,
    spuImgId: number
}
export interface skuSaleAttrValueList {
    id: number,
    saleAttrId: number,
    saleAttrName: string,
    saleAttrValueId: number,
    saleAttrValueName: string,
    skuId: number,
    spuId: number
}
export interface skuInfo {
    category3Id: number,
    createTime: string,
    id: number,
    isSale: number,
    price: number,
    skuAttrValueList: skuAttrValueList[],
    skuDefaultImg: string
    skuDesc: string,
    skuImageList: skuImageList[],
    skuName: string
    skuSaleAttrValueList: skuSaleAttrValueList[],
    spuId: number,
    tmId: number,
    weight: string
}
export interface getDetailModel {
    categoryView: categoryView,
    price: number,
    skuInfo: skuInfo,
    spuSaleAttrList: spuSaleAttrList[],
    valuesSkuJson: string,
}

export interface detailData {
    code: number,
    data: getDetailModel,
    message: string,
    ok: boolean
}
export default {
    // 获取产品详情
    getDetail(skuId: string) {
        return request.get<any, detailData>(`/app-dev/api/item/${skuId}`)
    }
}